import Vue from 'vue'
import Vuex from 'vuex'
import {getMusicLyric} from '@/api/player'
Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    player: [{ //播放列表
      al: {
        id: 1831766291,
        // name: "老巷啸先生",
        pic: 109951165982299490,
        picUrl: "https://p1.music.126.net/xCOYTLcm-q7QAZqhBUoBlw==/109951165982299488.jpg",
        pic_str: "109951165982299488"

      },
      ar:[{
        name:'老巷啸先生'
      }],
          name:'曾经心痛'
        ,
      id: 1476255581
    }],
    showTab:false,
    playerListIndex: 0, //默认下标
    isbntShow: false,//播放按钮的切换
     lyricList:{},//歌词
     Tcurrenttime:0,//当前时间
    duration: 0,//总时长
  },
  mutations: {
    updatedShowTab(state,value) {
       state.showTab = value
    },
    updataIsbntShow(state, value) {
      state.isbntShow = value
    },
    updatePlayer(state, value) {
      state.player = value
   
    },
      updatePlayerrListIndex(state, value) {
      state.playerListIndex = value
    },
  
    updatedLyricList(state,value) {
      state.lyricList = value
    },
    updatedTheCurrentTime(state,value) {
      state.Tcurrenttime = value
     
    },
  
    updatedDuration(state,value) {
       state.duration = value
      
    },
  },
   actions: {
     async getLyric({commit},value){ 
       await getMusicLyric(value).then(data=>{ 
        commit('updatedLyricList',data.lrc);
       })

       
       
     }
   },
  getters: {},

 
  modules: {}
})